using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using CE.Configuration;
using CE.Global;
using CE.User;

public partial class car_insurance_Motor_vehicle : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

        //lnkCarInsurance.NavigateUrl = "car_insurance/carAndpolicy_details.aspx";
        //lnkPersonalAccident.NavigateUrl = "personal_accident/personal_accident.aspx";
        //lnkTravelInsurance.NavigateUrl = "travel_insurance/travel_quote.aspx";
        string _strCXLive = CE.Configuration.MyConfigurationManager.GetAppSettingValue("IsCXLive");

        //if (_strCXLive == "0") //test
        //{
        //    if (Session[CE.Global.General.Guest] != null)
        //    {
        //        if (Session["PopAD"] == null)
        //        {
        //            Session["PopAD"] = "1";

        //            inputPop.Value = "1";
        //        }

        //    }
        //}
        //else
        //{
        //    if (Session["PopAD"] == null)
        //    {
        //        Session["PopAD"] = "1";

        //        inputPop.Value = "1";
        //    }
        //}



        if (Session[CE.Global.General.UserId] != null && Session[CE.Global.General.UserId].ToString() != "0")
        {

            divAfterLogin.Visible = true;
            //string[] _userName = Session[CE.Global.General.UserName].ToString().Split(' ');
            //string _strName = "";
            //if (_userName.Length > 0)
            //{
            //    for (int i = 0; i < _userName.Length; i++)
            //    {
            //        if (i == 0 && _userName[i].Length > 25)
            //        {
            //            _strName = _userName[i].Substring(0, 22) + "...";
            //            break;
            //        }
            //        else if (i == 0 && _userName[i].Length <= 25)
            //        {
            //            _strName += _userName[i].ToString();
            //        }
            //        else if (i > 0 && (_strName.Length + _userName[i].Length) <= 25)
            //        {
            //            _strName += " " + _userName[i];
            //        }
            //        else
            //        {
            //            break;
            //        }
            //    }
            //}
            //else
            //{
            //    _strName = Session[CE.Global.General.UserName].ToString();
            //}
            //lblUserLoginName.Text = _strName;
            //lblUserLoginName.ToolTip = Session[CE.Global.General.UserName].ToString();
            lblEmailAddress.Text = Session[CE.Global.General.UserEmail].ToString();
            lblEmailAddress.ToolTip = Session[CE.Global.General.UserName].ToString();
            divLogin.Visible = false;
        }
        else
        {
            divLogin.Visible = true;
            divAfterLogin.Visible = false;
        }

        if (!Page.IsPostBack)
        {
            //this.value=!this.value?'Email':this.value;
            txtExEmail.Attributes.Add("onblur", "ShowValidationEffectTwo('" + txtExEmail.ClientID + "','" + rfvExEmail.ClientID + "','" + rfvExEmailValid.ClientID + "')");
            txtExAuthCode.Attributes.Add("onblur", "ShowValidationEffect('" + txtExAuthCode.ClientID + "','" + rfvExAuthCode.ClientID + "')");
            //if (Request.ServerVariables["SERVER_NAME"].Contains("www.comparexpress.com"))
            //{
            //    string _sslLoginUrl = ibtLogin.PostBackUrl.ToString().Replace("http:", "https:");
            //    ibtLogin.PostBackUrl = _sslLoginUrl;
            //}
        }
    }

    protected void ibtLogin_Click(object sender, ImageClickEventArgs e)
    {
        Page.Validate();
        if (!Page.IsValid)
        {
            return;
        }
    }

    protected void btnLogin_Click(object sender, EventArgs e)
    {
        Page.Validate();
        if (!Page.IsValid)
        {
            return;
        }
    }

    protected void btnLogout_Click(object sender, EventArgs e)
    {
        Response.Redirect("~/user/logout.aspx");
    }
}